package com.gcsoftware.gateway.GWImpl;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by qs on 2018/4/12.
 */
public class RbacConsts {
    public static final String DFT_VALUE_STRING = "*";
    public static final String DFT_VALUE_CHAR = "*";

    public static final String DFT_VALUE_INT = "0";

    public static final String DFT_VALUE_BOOLEAN = "false";

    public static final String DFT_VALUE_DOUBLE = "0.0";

    public static final String DFT_VALUE_FLOAT = "0f";

    public static String DFT_DATE_VALUE = new SimpleDateFormat("yyyy-MM-dd").format(new Date());

    public static String DFT_TIMESTAMP_VALUE = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS").format(new Date());


    public static final String DATA_TYPE_STRING="IPARAMS_DATA_TYPE_STRING";
    public static final String DATA_TYPE_INT="IPARAMS_DATA_TYPE_INT";
    public static final String DATA_TYPE_BYTE="IPARAMS_DATA_TYPE_BYTE";
    public static final String DATA_TYPE_SHORT="IPARAMS_DATA_TYPE_SHORT";
    public static final String DATA_TYPE_LONG="IPARAMS_DATA_TYPE_LONG";
    public static final String DATA_TYPE_FLOAT="IPARAMS_DATA_TYPE_FLOAT";
    public static final String DATA_TYPE_DOUBLE="IPARAMS_DATA_TYPE_DOUBLE";
    public static final String DATA_TYPE_BOOLEAN="IPARAMS_DATA_TYPE_BOOLEAN";
    public static final String DATA_TYPE_CHAR="IPARAMS_DATA_TYPE_CHAR";
    public static final String DATA_TYPE_DATE="IPARAMS_DATA_TYPE_DATE";
    public static final String DATA_TYPE_TIMESTAMP="IPARAMS_DATA_TYPE_TIMESTAMP";
    public static String getDftValue(String dataType) {
        String obj = "";
        switch (dataType) {
            case DATA_TYPE_STRING:
            case DATA_TYPE_CHAR:
                obj = DFT_VALUE_STRING;
                break;
            case DATA_TYPE_INT:
            case DATA_TYPE_BYTE:
            case DATA_TYPE_FLOAT:
            case DATA_TYPE_SHORT:
            case DATA_TYPE_DOUBLE:
            case DATA_TYPE_LONG:
                obj = DFT_VALUE_INT;
                break;
            case DATA_TYPE_BOOLEAN:
                obj = DFT_VALUE_BOOLEAN;
                break;
            case DATA_TYPE_DATE:
                obj = DFT_DATE_VALUE;
                break;
            case DATA_TYPE_TIMESTAMP:
                obj = DFT_TIMESTAMP_VALUE;
                break;
        }
        return obj;
    }
}
